<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileOverview 언론사별보기 컨텐츠를 구성
<span class='line'>  3</span>  * @author oz_moon
<span class='line'>  4</span>  */</span><span class="WHIT">
<span class='line'>  5</span> </span><span class="NAME">nhn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.nhn</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  6</span> </span><span class="NAME">nhn.newsstand</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  7</span> </span><span class="NAME">nhn.newsstand.press</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand.press</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  8</span> </span><span class="NAME">nhn.newsstand.press.ContentLoader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Class</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>  9</span> </span><span class="WHIT">	</span><span class="COMM">/** @lends nhn.newsstand.press.ContentLoader.prototype */</span><span class="WHIT">
<span class='line'> 10</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 11</span> 	 * nhn.newsstand.press.ContentLoader 클래스의 인스턴스를 생성한다.  
<span class='line'> 12</span> 	 * @constructs
<span class='line'> 13</span> 	 * @class 언론사별보기 컨텐츠를 구성
<span class='line'> 14</span> 	 * &lt;br/>- 언론사별보기 컨텐츠를 Ajax 응답을 통해 로딩하고 브라우저 크기에 따라 재배치
<span class='line'> 15</span> 	 * &lt;br/>- 재배치된 컨텐츠에 따라 페이지네이션 정보 업데이트 처리
<span class='line'> 16</span> 	 * &lt;br/>- 선택된 언론사 타이틀 표시
<span class='line'> 17</span> 	 * @extends jindo.Component
<span class='line'> 18</span> 	 * @requires nhn.newsstand.press.ContentLoader.oHTML
<span class='line'> 19</span> 	 * @requires window.ImageUrlGenerator
<span class='line'> 20</span> 	 * @example
<span class='line'> 21</span> 	 * var oContent = new nhn.newsstand.press.ContentLoader( oOption );
<span class='line'> 22</span> 	 * 1. oOption => 컨텐츠를 구성하는데 필요한 값 모음
<span class='line'> 23</span> 	 * 1-1. elTitleLayer => 타이틀 컨텐츠 노출할 기준 엘리먼트
<span class='line'> 24</span> 	 * 1-2. elImageModeLayer => 목록 컨텐츠를 노출할 기준 엘리먼트
<span class='line'> 25</span> 	 * @example
<span class='line'> 26</span> 	 * //CustomEvent
<span class='line'> 27</span> 	 * oContent.attach({
<span class='line'> 28</span> 	 *     "completeLoadContent" : function(oCustomEvent){  //컨텐츠 로드 완료시 한번 발생 
<span class='line'> 29</span> 	 *         //oCustomEvent.container => 로드된 컨텐츠를 포함하고 있는 상위 엘리먼트		
<span class='line'> 30</span> 	 *     }
<span class='line'> 31</span> 	 * })
<span class='line'> 32</span> 	 */</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="WHIT">	</span><span class="NAME">$init</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oOptions</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">		</span><span class="NAME">this.welTitleLayer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Element</span><span class="PUNC">(</span><span class="NAME">oOptions.elTitleLayer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">		</span><span class="NAME">this.welImageModeLayer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Element</span><span class="PUNC">(</span><span class="NAME">oOptions.elImageModeLayer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 39</span> 	 * 컨텐츠를 갱신한다.
<span class='line'> 40</span> 	 * @param {Array} aResult 컨텐츠 구성시 사용할 데이터(템플릿에 사용될 데이터)
<span class='line'> 41</span> 	 */</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">	</span><span class="NAME">loadContents</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oResult</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">		</span><span class="NAME">this.oLastResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">		</span><span class="NAME">this._updateTitle</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">		</span><span class="NAME">this._updateList</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 47</span> 
<span class='line'> 48</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 49</span> 	 * 주어진 키에 해당하는 템플릿을 가져온다.
<span class='line'> 50</span> 	 */</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">	</span><span class="NAME">_getTemplate</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sTemplateKey</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand.press.ContentLoader.oHTML</span><span class="PUNC">[</span><span class="NAME">sTemplateKey</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 56</span> 	 * 타이틀 영역을 갱신한다.
<span class='line'> 57</span> 	 */</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">	</span><span class="NAME">_updateTitle</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.oLastResult.firstPages.firstPage</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">oData</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">			</span><span class="NAME">this.welTitleLayer.html</span><span class="PUNC">(</span><span class="NAME">$Template</span><span class="PUNC">(</span><span class="NAME">this._getTemplate</span><span class="PUNC">(</span><span class="STRN">"PRESS_TITLE"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">process</span><span class="PUNC">(</span><span class="NAME">oData</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 66</span> 	 * 목록 영역을 갱신한다.
<span class='line'> 67</span> 	 */</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">	</span><span class="NAME">_updateList</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.oLastResult</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hasArticle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.oLastResult.firstPages.firstPage.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">hasArticle</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">welListLayer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Element</span><span class="PUNC">(</span><span class="NAME">this.welImageModeLayer.query</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">			</span><span class="NAME">this._addThumbnailProperty</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">			</span><span class="NAME">welListLayer.html</span><span class="PUNC">(</span><span class="NAME">$Template</span><span class="PUNC">(</span><span class="NAME">this._getTemplate</span><span class="PUNC">(</span><span class="STRN">"PAPER_LIST"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">process</span><span class="PUNC">(</span><span class="NAME">this.oLastResult</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">		</span><span class="NAME">this.fireEvent</span><span class="PUNC">(</span><span class="STRN">"completeLoadContent"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">container</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.welImageModeLayer.$value</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 84</span> 	 * 썸네일 이미지 URL 생성하여 템플릿에 사용될 데이터에 추가한다.
<span class='line'> 85</span> 	 */</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">	</span><span class="NAME">_addThumbnailProperty</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">aListData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.oLastResult.firstPages.firstPage</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">		</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nIdx</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nLen</span><span class="PUNC">=</span><span class="NAME">aListData.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">nIdx</span><span class="PUNC">&lt;</span><span class="NAME">nLen</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">nIdx</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oItem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">aListData</span><span class="PUNC">[</span><span class="NAME">nIdx</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">			</span><span class="NAME">oItem.thumbnail</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ImageUrlGenerator</span><span class="PUNC">(</span><span class="STRN">"news"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"181_247"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oItem.pressCd</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oItem.publDate</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oItem.publType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oItem.editionNo</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oItem.pageNo</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">createImageUrl</span><span class="PUNC">(</span><span class="NAME">window.NORMAL_URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">extend</span><span class="PUNC">(</span><span class="NAME">jindo.Component</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 95</span> 
<span class='line'> 96</span> </span><span class="NAME">nhn.newsstand.press.ContentLoader.oHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">	</span><span class="NAME">PAPER_LIST</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">    	</span><span class="STRN">'{for idx:data in firstPages.firstPage}'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;li>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;div class="article _toggleView">'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;div class="thmb">'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;a href="/viewer/index.nhn?id={=data.pageId}">&lt;img src="{=data.thumbnail}" onerror="oUtil.noImage(this, 181, 247);">&lt;/a>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;/div>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;div class="dec" style="display:none;">'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">	    	</span><span class="STRN">'&lt;strong>&lt;a href="/viewer/index.nhn?id={=data.pageId}" class="_nclicks(prs.otitle,{=data.articleId},{=idx+1})">{=data.headlineTitle}&lt;/a>&lt;span>{=data.pressNm} {=data.pageNo}면&lt;/span>&lt;/strong>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">            </span><span class="STRN">'&lt;p>&lt;a href="/viewer/index.nhn?id={=data.pageId}" class="_nclicks(prs.ocon,{=data.articleId},{=idx+1})">{js $S(=data.headlineSummary).escapeHTML()}&lt;/a>&lt;/p>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;/div>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;/div>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;dl>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;dt>&lt;input type="checkbox" id="ck_{=data.volumeId}" class="chk _selectchk _nclicks_async(prs.select,,{=idx+1})" value="{=data.volumeId}">&lt;label for="ck_{=data.volumeId}">{js oUtil.changePublDateFormat(=data.publDate, ".")}&lt;/label>&lt;/dt>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;/dl>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;/li>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">    	</span><span class="STRN">'{/for}'</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">    </span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">    </span><span class="NAME">PRESS_TITLE</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">    	</span><span class="STRN">'&lt;span class="m_{=pressCd}">{=pressNm}&lt;/span>'</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT">    </span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>118</span> </span><span class="PUNC">}</span><span class="PUNC">;</span></pre></body></html>